@echo off

REM https://www.iar.com/support/tech-notes/general/build-from-the-command-line/
set PATH="D:\Program Files\IAR Systems\ewarm-9.60.4\common\bin\";%PATH%
echo "Prepare for Build, clear old release lib ....."

echo "Press any key to start build"
@PAUSE

set "t=%time%"
echo "[----------Build bms_adapter     Begin-------------]"
iarbuild .\bms_adapter\bms_adapter.ewp -build flash
echo "[---------------------End.-------------------------]"

set "t1=%time%"
if "%t1:~,2%" lss "%t:~,2%" set "add=+24"
set /a "times=(%t1:~,2%-%t:~,2%%add%)*360000+(1%t1:~3,2%%%100-1%t:~3,2%%%100)*6000+(1%t1:~6,2%%%100-1%t:~6,2%%%100)*100+(1%t1:~-2%%%100-1%t:~-2%%%100)" ,"ss=(times/100)%%60","mm=(times/6000)%%60","hh=times/360000","ms=times%%100"
echo Run time: %hh%:%mm%:%ss%.%ms%

@PAUSE
@exit /B 0

:err
@PAUSE
@exit /B 1
